setwd(pathR)

source("displayfunctionNM.R")

epr.final <- epr.final %>%
				group_by(countries_gwid) %>%
					mutate(ever.conference=max(past.conference.presence.noIR))


year <- sort(unique(epr.final$year))
	countries_gwid <- unique(epr.final$countries_gwid)

epr.frame <- expand_grid(countries_gwid,year)
	epr.frame <- left_join(epr.frame,epr.final)	
		epr.frame <- epr.frame[duplicated(epr.frame[,c("countries_gwid","year")])==FALSE,]


epr.frame$year <- as.integer(epr.frame$year)
	epr.frame$countries_gwid <- as.integer(epr.frame$countries_gwid)
		epr.frame <- data.frame(epr.frame)

country.table <- unique(epr.frame[,c("countries_gwid","countryname")])
	country.table <- country.table[is.na(country.table$countryname)==FALSE,]


epr.frame <- epr.frame[,c("countries_gwid","year","past.conference.presence.noIR","past.conference.number.noIR")]
	epr.frame <- left_join(epr.frame,country.table)
		epr.frame <- epr.frame[epr.frame$year<2017,]


p <- display.function.nm(unit.id = "countryname",
                 time.id = "year", legend.position = "none",
                 xlab = "Year", ylab = "Country",x.angle=90,title="",
                 treatment = "past.conference.number.noIR", data = epr.frame)	                 
                 
                 
setwd(pathOUT)                 
             ggsave("displayC.pdf",p,width = 20*1.63, height = 20, units = c("cm"))  
             
             
             
             
             
                            			